package com.docker.sys.role.rolePerm;

import com.docker.core.constant.MainConstant;
import com.docker.core.mvc.dao.BaseDao;
import com.jfinal.kit.Okv;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

/**
 * @Author ldl
 * @Create 2020/09/18 018 15:34
 */
public class RolePermDao extends BaseDao {

    @Override
    protected String getDbName() {
        return MainConstant.DB_DOCKER;
    }

    @Override
    protected String getSqlTplNameSpace() {
        return "sys.role.permission";
    }

    public List<Record> bindList() {
        return tplList("bind.list");
    }

    public void deletePerm(String pmsnId) {
        tplDelete("delete.perm", pmsnId);
    }

    public List<Record> authList(Okv cond) {
        return tplSPList("list.auth", cond);
    }

    public List<Record> tree(Okv cond) {
        return tplSPList("tree", cond);
    }

    public boolean save(Record rolePerm) {
        return save("sys_role_permission", "rp_id", rolePerm);
    }

    public void delete(String roleId, String permId) {
        tplDelete("delete", roleId, permId);
    }

}
